﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using RazakiBLL;
using RazakiBLL.Entities;
using RazakiBLL.Managers;

namespace RazakiSite.UserControls.New
{
    public partial class UCParentTagsList : BaseUserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
                return;

            UowRazaki uowRazaki = new UowRazaki();
            List<NewTag> result;

            if (UtilitiesUI.IsAdmin())
            {
                result = uowRazaki.NewTagRepository.GetAllParents();
            }
            else
            {
                var exceptions = new List<ENewTagExceptionFirstParents> { ENewTagExceptionFirstParents.minoosoft };

                result = uowRazaki.NewTagRepository.GetAllParents(exceptions);
            }

            DataListParent.DataSource = result;
            DataListParent.DataBind();
        }
    }
}